Real-time multithreaded control environments require careful synchronization of control sequences affecting system shared resources. These control sequence interactions can be modeled after the well known producer/consumer model. In a producer/consumer relationship, a producer control thread initiates a control action, which is responded to by a control action from a consumer control thread. This causal connection between producer and consumer threads is a more general form of the typical producer/consumer example, where a producer first places data in a shared buffer and a consumer subsequently reads the data from the shared buffer.
In most real world situations, the producer and consumer control threads operate independently for extended periods of time. If proper care is not taken, timing and interaction issues can cause incorrect behavior or even result in a system crash. As a result, the actions of the producer and consumer must be synchronized carefully to maintaining program correctness. This synchronization may be implemented using a mutual exclusion policy, where only one process has access to a shared resource, or “critical section,” at a time.
In addition to operating independently from one another, the producer and consumer also tend to be isolated from one another. The isolation can be a physical isolation (e.g. producer and consumer are on different systems), or the isolation can be a logical/virtual one (e.g. producer and consumer have different regulation mechanisms). Regardless of the type of isolation, producer control source code (i.e. the specific tangible sequence of commands, instructions or states that implement the control procedure) is generally developed independently from consumer control source code. However, during execution, control loops for producers and consumers are no longer completely independent because they must synchronize themselves in order to maintain program correctness.
Producers and consumers may synchronize by transferring filtered views of their respective internal states to one another using sideband channels. The filtering effect is a function of the separation between the producer and consumer and causes information loss as the validity of real-time data decays over the course of transmission. When loss of synchronization occasionally occurs, either through signal corruption or from unexpected temporal sequences that expose latent bugs, the system may degrade into an unusable state. This loss of synchronization can be devastating in certain critical applications. Furthermore, as the number of producers and consumers increase, the sideband signaling can become unwieldy.
Alternatively, the producer and consumer may transfer explicit references to one another's internal states by passing messages. While passing references may fix some scaling problems associated with sideband signaling, other issues may still occur from passing and/or replicating the message, including bandwidth, throughput, and latency delays.
Another notable issue with producer/consumer models is that because of the separation in control sequences, the state space of the system is now the product space of the individual control loops. For example, if a producer had m states and a consumer had n states, the state space of the system would consist of (m×n) states. This product space has the negative side effect of significantly increasing the validation effort because more system states need to be tested.